<template>
	<view style="padding: 20rpx;">
		<view class="detail">
			<view class="title">
				<text>{{res.rsName}}</text>
			</view>
			<view class="content">
				<rich-text :nodes="res.docDesc"></rich-text>
			</view>
			<view class="pdf-box" v-if="res.files.length">
				<view class="pdf-item" v-for="(file, index) in res.files" :key="index" @click="openPdf(file.url)">
					<text>{{ file.name }}</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				res: {
					"id": "",
					"createUser": "",
					"createTime": "",
					"updateUser": "",
					"updateTime": "",
					"isDeleted": "",
					"note": "",
					"rsName": "",
					"fileNo": "",
					"releaseDate": "",
					"releaseOrgan": "",
					"executionDate": "",
					"busiType": "",
					"docDesc": "",
					"releaseStatus": "",
					"modifyDate": "",
					"modifyUser": "",
					"modifyUserId": "",
					"executionEndDate": "",
					"releaseEndDate": "",
					"files": ""
				},

			}
		},
		methods: {
			openPdf(url) {
				// window.open(url + "?response-content-type=application/pdf");
				this.$goBack('/pages/dgs_qy/preview/index?url=' + encodeURIComponent(url))
			}
		},
		onLoad(params) {
			this.$api.policyKnowDetail(params.id).then(res => {
				Object.assign(this.res, res.data.data);
			})
		}
	}
</script>

<style lang="scss">
	.detail {
		background-color: #FFFFFF;
		border-radius: 10rpx;

		.title {
			text-align: center;
			font-size: 32rpx;
			color: #000000;
			line-height: 44rpx;
			padding: 30rpx 20rpx;
		}

		.content {
			padding: 30rpx 20rpx;
			border-top: 1rpx solid #EEEEEE;
		}

		.pdf-box {
			padding: 20rpx;
			border-top: 1rpx solid #EEEEEE;
			display: flex;

			.pdf-item {
				padding: 10rpx 20rpx;
				color: #1785FF;
			}
		}
	}
</style>
